use crate::api::prelude::*;
use carpet::base::error::ServerError;

#[text_dto]
pub struct RequestData {
    pub title: String,

    pub age: Option<i32>,
}

#[text_dto]
pub struct SendMessage {
    pub content: String,
}

#[text_dto]
pub struct ReceiveMessage {
    pub content: String,
}

#[handler(protocol = "ws", method=GET,)]
async fn _handle(
    self, 
    upgrade: WsUpgrade<SendMessage, ReceiveMessage, i32, i32>,  
    data: Query<RequestData>,
) -> Result<WsResponse, ServerError>;